
strstr2.o:     file format elf64-littleaarch64


Disassembly of section .text:

0000000000000000 <sub_string>:
#include <string.h>
#include <stdio.h>

char * sub_string(unsigned char * des, unsigned char * src, unsigned int len)
{
   0:	d100c3ff 	sub	sp, sp, #0x30
   4:	f9000fe0 	str	x0, [sp, #24]
   8:	f9000be1 	str	x1, [sp, #16]
   c:	b9000fe2 	str	w2, [sp, #12]
	char *tmp = des;
  10:	f9400fe0 	ldr	x0, [sp, #24]
  14:	f90017e0 	str	x0, [sp, #40]

	while(len > 0 && len--) {
  18:	14000009 	b	3c <sub_string+0x3c>
		*des++ = *src++;
  1c:	f9400fe0 	ldr	x0, [sp, #24]
  20:	91000401 	add	x1, x0, #0x1
  24:	f9000fe1 	str	x1, [sp, #24]
  28:	f9400be1 	ldr	x1, [sp, #16]
  2c:	91000422 	add	x2, x1, #0x1
  30:	f9000be2 	str	x2, [sp, #16]
  34:	39400021 	ldrb	w1, [x1]
  38:	39000001 	strb	w1, [x0]
	while(len > 0 && len--) {
  3c:	b9400fe0 	ldr	w0, [sp, #12]
  40:	7100001f 	cmp	w0, #0x0
  44:	540000c0 	b.eq	5c <sub_string+0x5c>  // b.none
  48:	b9400fe0 	ldr	w0, [sp, #12]
  4c:	51000401 	sub	w1, w0, #0x1
  50:	b9000fe1 	str	w1, [sp, #12]
  54:	7100001f 	cmp	w0, #0x0
  58:	54fffe21 	b.ne	1c <sub_string+0x1c>  // b.any
	}

	return tmp;
  5c:	f94017e0 	ldr	x0, [sp, #40]
}
  60:	9100c3ff 	add	sp, sp, #0x30
  64:	d65f03c0 	ret

0000000000000068 <main>:


int main()
{
  68:	a9ba7bfd 	stp	x29, x30, [sp, #-96]!
  6c:	910003fd 	mov	x29, sp
	char *haystack = "aaa||bbb||ccc||eee";
  70:	90000000 	adrp	x0, 0 <sub_string>
  74:	91000000 	add	x0, x0, #0x0
  78:	f9002fa0 	str	x0, [x29, #88]
	char *needle = "||";
  7c:	90000000 	adrp	x0, 0 <sub_string>
  80:	91000000 	add	x0, x0, #0x0
  84:	f90027a0 	str	x0, [x29, #72]
	char *buf = strstr( haystack, needle);
  88:	f94027a1 	ldr	x1, [x29, #72]
  8c:	f9402fa0 	ldr	x0, [x29, #88]
  90:	94000000 	bl	0 <strstr>
  94:	f9002ba0 	str	x0, [x29, #80]
	char ch[10] = "1";
  98:	90000000 	adrp	x0, 0 <sub_string>
  9c:	91000000 	add	x0, x0, #0x0
  a0:	79400000 	ldrh	w0, [x0]
  a4:	790063a0 	strh	w0, [x29, #48]
  a8:	f80323bf 	stur	xzr, [x29, #50]
	char *p;

	char dddd[30] = "xiaozhiwise";
  ac:	90000000 	adrp	x0, 0 <sub_string>
  b0:	91000001 	add	x1, x0, #0x0
  b4:	910043a0 	add	x0, x29, #0x10
  b8:	f9400022 	ldr	x2, [x1]
  bc:	f9000002 	str	x2, [x0]
  c0:	b9400821 	ldr	w1, [x1, #8]
  c4:	b9000801 	str	w1, [x0, #8]
  c8:	910073a0 	add	x0, x29, #0x1c
  cc:	a9007c1f 	stp	xzr, xzr, [x0]
  d0:	79005bbf 	strh	wzr, [x29, #44]

	while( buf != NULL )
  d4:	1400000f 	b	110 <main+0xa8>
	{
		printf( "%s\n ", haystack);
  d8:	90000000 	adrp	x0, 0 <sub_string>
  dc:	91000000 	add	x0, x0, #0x0
  e0:	f9402fa1 	ldr	x1, [x29, #88]
  e4:	94000000 	bl	0 <printf>
		haystack = buf + strlen(needle);
  e8:	f94027a0 	ldr	x0, [x29, #72]
  ec:	94000000 	bl	0 <strlen>
  f0:	aa0003e1 	mov	x1, x0
  f4:	f9402ba0 	ldr	x0, [x29, #80]
  f8:	8b010000 	add	x0, x0, x1
  fc:	f9002fa0 	str	x0, [x29, #88]
		/* Get next token: */
		buf = strstr( haystack, needle);
 100:	f94027a1 	ldr	x1, [x29, #72]
 104:	f9402fa0 	ldr	x0, [x29, #88]
 108:	94000000 	bl	0 <strstr>
 10c:	f9002ba0 	str	x0, [x29, #80]
	while( buf != NULL )
 110:	f9402ba0 	ldr	x0, [x29, #80]
 114:	f100001f 	cmp	x0, #0x0
 118:	54fffe01 	b.ne	d8 <main+0x70>  // b.any
	}

	printf("%d\n", atoi(ch));
 11c:	9100c3a0 	add	x0, x29, #0x30
 120:	94000000 	bl	0 <atoi>
 124:	2a0003e1 	mov	w1, w0
 128:	90000000 	adrp	x0, 0 <sub_string>
 12c:	91000000 	add	x0, x0, #0x0
 130:	94000000 	bl	0 <printf>

	p = sub_string(ch, dddd+4, 4);
 134:	910043a0 	add	x0, x29, #0x10
 138:	91001000 	add	x0, x0, #0x4
 13c:	9100c3a3 	add	x3, x29, #0x30
 140:	52800082 	mov	w2, #0x4                   	// #4
 144:	aa0003e1 	mov	x1, x0
 148:	aa0303e0 	mov	x0, x3
 14c:	94000000 	bl	0 <sub_string>
 150:	f90023a0 	str	x0, [x29, #64]
	printf("%s\n", p);
 154:	f94023a0 	ldr	x0, [x29, #64]
 158:	94000000 	bl	0 <puts>

	printf("%ld\n", strlen("xia\0as22"));
 15c:	90000000 	adrp	x0, 0 <sub_string>
 160:	91000000 	add	x0, x0, #0x0
 164:	d2800061 	mov	x1, #0x3                   	// #3
 168:	94000000 	bl	0 <printf>
	printf("%d\n", '9' - '0');
 16c:	90000000 	adrp	x0, 0 <sub_string>
 170:	91000000 	add	x0, x0, #0x0
 174:	52800121 	mov	w1, #0x9                   	// #9
 178:	94000000 	bl	0 <printf>

	return 0;
 17c:	52800000 	mov	w0, #0x0                   	// #0
}
 180:	a8c67bfd 	ldp	x29, x30, [sp], #96
 184:	d65f03c0 	ret
